#ifndef CLIENTHANDEL_H
#define CLIENTHANDEL_H

#include <QTcpSocket>
#include <QTimer>
#include <QMap>
#include <QSet>
#include <QStringList>
#include <QHostAddress>

class ClientHandle : public QTcpSocket
{
    Q_OBJECT

public:
    /*!
     * \brief Constructor for the ClientHandler.
     * \param _id is a qintptr which will be used to set the socket.
     * \param _name is a QString which will be used to set the Client's name.
     */
    ClientHandle(qintptr _id = -1, const QString &_name = "", QObject *parent = 0);

    ClientHandle & operator = (const ClientHandle &c);

    /*!
     * \brief Saves the clients name to the relative member variable.
     * \param _name is the QString which will be saved to the member variable.
     */
    void setName(const QString &_name) { m_name = _name; }

    /*!
     * \brief Sets the socket descriptor for the object using the id passed to it.
     * \param _id is an integer which will be used to set the socket descriptor.
     */
    void setId(int _id) { setSocketDescriptor(_id); }
	
    /*!
     * \brief Returns the socket descriptor of the client.
     */
    int getId() const { return socketDescriptor(); }

    /*!
     * \brief Returns the name of the client object.
     */
    QString getName() const { return m_name; }

    /*!
     * \brief Returns the direction of the client as a int (0=North, 3=West).
     */
    //int getDirection() { return direction; }

    /*!
     * \brief Returns the client's IP address.
     */
    QString getIpAddress() const { return peerAddress().toString(); }

    //void setDirection(int dir) { direction = dir;}

private:
    QString m_name;
};

#endif // CLIENTHANDEL_H
